package com.android.qjpmc.application_module.viewModel;

import com.android.qjpmc.application_module.contract.HistoryDataContract;
import com.android.qjpmc.application_module.home.model.StationDataModel;
import com.android.qjpmc.bean.PwrDeviceBean;
import com.android.qjpmc.bean.StationDataBean;
import com.android.qjpmc.widget.mvvm.factory.CreateModel;
import com.android.qjpmc.widget.retrofithelper.rxsubscriber.ProgressObserver;

import java.util.List;

@CreateModel(StationDataModel.class)
public class HistoryDataViewModel extends HistoryDataContract.ViewModel {
    public void getGroupListOfStation(String stationId) {
        mView.showLoading("");
        mModel.getGroupListOfStation(stationId).subscribe(new ProgressObserver<List<PwrDeviceBean>>(false, this) {
            @Override
            public void _onNext(List<PwrDeviceBean> pwrDeviceBeans) {

                returnStationData(pwrDeviceBeans);

            }
        });
    }

    private void returnStationData(List<PwrDeviceBean> pwrDeviceBeans) {
        StationDataBean data = new StationDataBean();
        data.stationGroupList = pwrDeviceBeans;
        mView.showContent(data);
    }
}
